home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / football / user / matchanalysis.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-29  |  25KB  |  749 lines

  1. /* Mode=Run */
  2. /* ***********************************************************************
  3.  
  4.    MATCH ANALYSIS FOR FOOTBALL REXX SUITE
  5.   ----------------------------------------
  6.                    Copyright  Mark Naughton 1997
  7.  
  8.  
  9. Version    Date     History
  10. --------------------------------------------------------------------------
  11.  1.0       050197   First release.
  12.  1.1       150997   Added code to handle automatic scheduling with dates.
  13.                     As matches are played mid-week, it was better to get
  14.                     all the games in a 7-day period than just reading the
  15.                     Learn file where they are grouped together in the
  16.                     number of teams divide by 2 (some games would be outside
  17.                     this 7-day period). Amended displays.
  18.  1.2       250997   Amended displays of highest/lowest because when using
  19.                     dates, these still gave the week numbers. Routine that
  20.                     calculates the date for the listing is now a callable
  21.                     procedure. Fixed bug where the program expected games
  22.                     to be played every week and added games to weeks that
  23.                     had no games played - the range wasn't incremented
  24.                     enough.
  25.            151297   Tidied display. Added average number of goals per
  26.                     game for highest/lowest.
  27.            310599   Changed to handle extra data in '.sflearn' file.
  28.            250899   Added error msg to file checks.
  29.            050999   Converted to use locale. Some error messages, before
  30.                     reading the locale, will still be in English.
  31.                     Converted to use a global date format file. Now correctly
  32.                     translates date format to get required data.
  33.            050999   Found a problem where if the datafile was created with
  34.                     a different locale, you wouldn't be able to read it so
  35.                     now we read through the control files for all locales
  36.                     making sure we find the correct date data.
  37.            180999   Added support for own goals, bookings, red cards and
  38.                     attendances - but only if they have been input.
  39.                     Changed schedule directory.
  40.            021099   Added code to set markers when matches are played (sflearn
  41.                     is now read into an array) - this means the wrong match
  42.                     will NOT be picked up. Changed position of code that reads
  43.                     sflearn - now reads data based on match not on position.
  44.                     All works. Added code to display data that isn't used
  45.                     indicating a problem.
  46.  
  47.  
  48. **************************************************************************
  49.  
  50. Procedure
  51. ---------
  52.  
  53. 1. Check files exist. Read Teams.df datafile and store league name.
  54. 2. If automatic scheduling, open Schedule definition file and store
  55.    whether it is run by WEEKS or DATES.
  56. 3. Open Learn file if WEEKS or non-auto sched and get statistics for
  57.    each match for each week. Close file.
  58. 4. Open '.sf' file if DATES and get statistics for each match for each
  59.    week. Increase the range from the start date as the file goes on, adding
  60.    7 days. Close file.
  61. 5. Get the highest and lowest scoring weeks.
  62. 6. Display data and exit.
  63.  
  64. ************************************************************************** */
  65. PARSE ARG league_stuff
  66.  
  67. version      = 1
  68. input_file   = '.df'
  69. input2_file  = '.sflearn'
  70. input3_file  = '.sf'
  71. title        = '*LEAGUE_NAME='
  72. autosched    = '*AUTOSCHD='
  73. separator    = '*'
  74. games.       = '???'
  75. homew.       = '???'
  76. awayw.       = '???'
  77. draws.       = '???'
  78. losses.      = '???'
  79. goalss.      = '???'
  80. yellows.     = '???'
  81. reds.        = '???'
  82. attendances. = '???'
  83. owngoals.    = '???'
  84. selines.     = '???'
  85. semkrs.      = '???'
  86. secount      = 0
  87. weeks        = 0
  88. weekend.     = '???'
  89. months       = "January February March April May June July August September October November December"
  90. not_played   = '__   __'
  91.  
  92.  
  93. parse var league_stuff league_file
  94. league_file = "Data/" || league_file
  95.  
  96. addlib('rexxsupport.library',0,-30,0)
  97.  
  98. if open(datafile,"Data/Football.locale",'r') then do
  99.    line = readln(datafile)
  100.    locdir = strip(line)
  101.    close(datafile)
  102. end
  103. else do
  104.    say
  105.    say "ERROR :    (MatchAnalysis)"
  106.    say
  107.    say "Cannot read 'Data/Football.locale' for the locale settings."
  108.    exit
  109. end
  110.  
  111. dfordir = locdir"Football.locale_data"
  112. locdir = locdir"User/MatchAnalysis.data"
  113.  
  114. if open(datafile,"ENV:FootballRXPath",'r') then do
  115.    line = readln(datafile)
  116.    rxdir = strip(line)
  117.    close(datafile)
  118. end
  119. else
  120.    rxdir = "SYS:Rexxc/"
  121.  
  122. if exists(locdir) > 0 then do
  123.   address command rxdir'rx 'locdir
  124.   VarCount = getclip('VarCount')
  125.   do i = 1 to VarCount
  126.     interpret getclip('var.'i)
  127.   end
  128. end
  129. else do
  130.    say
  131.    say "ERROR :    (MatchAnalysis)"
  132.    say
  133.    say "Cannot find '"locdir"' to read locale settings."
  134.    exit
  135. end
  136.  
  137. if exists(dfordir) > 0 then do
  138.   address command rxdir'rx 'dfordir
  139.   VarCount = getclip('VarCount')
  140.   do i = 1 to VarCount
  141.     interpret getclip('var.'i)
  142.   end
  143. end
  144. else do
  145.    say
  146.    say "ERROR :    (MatchAnalysis)"
  147.    say
  148.    say "Cannot find '"dfordir"' to read date locale settings."
  149.    exit
  150. end
  151.  
  152.  
  153. if exists(league_file || input_file) = 0  then do
  154.    say
  155.    say ma_t1
  156.    say
  157.    say ma_t2"'"league_file || input_file"'."
  158.    exit
  159. end
  160.  
  161. if exists(league_file || input2_file) = 0  then do
  162.    say
  163.    say ma_t1
  164.    say
  165.    say ma_t2"'"league_file || input2_file"'."
  166.    exit
  167. end
  168.  
  169. if exists(league_file || input3_file) = 0  then do
  170.    say
  171.    say ma_t1
  172.    say
  173.    say ma_t2"'"league_file || input3_file"'."
  174.    exit
  175. end
  176.  
  177. autos = 0
  178. if open(datafile,league_file || input_file,'r') then do
  179.    do while ~eof(datafile)
  180.       line = readln(datafile)
  181.       if pos(title,line) > 0 then
  182.          league_title = delstr(line,1,13)
  183.       if pos(autosched,line) > 0 then do
  184.          autofile = delstr(line,1,10)
  185.          autos = 1
  186.       end
  187.    end
  188.    close(datafile)
  189. end
  190. else do
  191.    say
  192.    say ma_t1
  193.    say
  194.    say ma_t3"'"league_file || input_file"' "ma_t4
  195.    exit
  196. end
  197.  
  198. type = 0
  199. if autos = 1 then do
  200.    if open(datafile,"Data/Schedules/"||autofile||".schd",'r') then do
  201.       line = readln(datafile)
  202.       if pos("*WEEKS",line) > 0 then
  203.          type = 10
  204.       if pos("*DATES",line) > 0 then do
  205.          type = 20
  206.          start_date = substr(line,8,8)
  207.       end
  208.       close(datafile)
  209.    end
  210.    else do
  211.       say
  212.       say ma_t1
  213.       say
  214.       say ma_t3"'Data/Schedules/"autofile".schd' "ma_t5
  215.       exit
  216.    end
  217. end
  218.  
  219. att_mkr = 0    /* for possible extra values */
  220. yel_mkr = 0
  221. red_mkr = 0
  222. og_mkr = 0
  223.                           /* use this method if its WEEKS or non-auto sched. */
  224. if type < 20 then do
  225.    if open(datafile,league_file || input2_file,'r') then do
  226.       do while ~eof(datafile)
  227.          line = readln(datafile)
  228.          if pos(separator,line) = 0 then do
  229.             if separator = sep then do           /* CHANGE 31/05 */
  230.                weeks = weeks + 1
  231.                sep = ''
  232.                games.weeks = 0
  233.                homew.weeks = 0
  234.                awayw.weeks = 0
  235.                draws.weeks = 0
  236.                losses.weeks = 0
  237.                goalss.weeks = 0
  238.                yellows.weeks= 0
  239.                reds.weeks = 0
  240.                owngoals.weeks = 0
  241.                attendances.weeks = 0
  242.                goals_for = 0
  243.                goals_aga = 0
  244.                goals = 0
  245.             end
  246.             goals_for = strip(substr(line,32,2))
  247.             goals_aga = strip(substr(line,37,2))
  248.             if datatype(goals_for,'n') = 0 | datatype(goals_aga,'n') = 0 then
  249.                leave
  250.             games.weeks = games.weeks + 1
  251.             goalss.weeks = goalss.weeks + goals_for + goals_aga
  252.  
  253.             if goals_for > goals_aga then do
  254.                homew.weeks = homew.weeks + 1
  255.                losses.weeks= losses.weeks + 1
  256.             end
  257.             if goals_for = goals_aga then do
  258.                draws.weeks = draws.weeks + 1
  259.             end
  260.             if goals_for < goals_aga then do
  261.                awayw.weeks = awayw.weeks + 1
  262.                losses.weeks= losses.weeks + 1
  263.             end
  264.          end
  265.          else do
  266.             if pos("(og)",line) > 0 then do
  267.                og_mkr = 1
  268.                owngoals.weeks = owngoals.weeks + 1
  269.             end
  270.             if pos("*ATD=",line) > 0 then do
  271.                att_mkr = 1
  272.                parse var line "*ATD=" attend
  273.                attendances.weeks = attendances.weeks + attend
  274.             end
  275.             if pos("*HY=",line) > 0 | pos("*AY=",line) > 0 then do
  276.                yel_mkr = 1
  277.                yellows.weeks = yellows.weeks + 1
  278.             end
  279.             if pos("*HR=",line) > 0 | pos("*AR=",line) > 0 then do
  280.                red_mkr = 1
  281.                reds.weeks = reds.weeks + 1
  282.             end
  283.             if pos("*HYR=",line) > 0 | pos("*AYR=",line) > 0 then do
  284.                yel_mkr = 1
  285.                red_mkr = 1
  286.                yellows.weeks = yellows.weeks + 1
  287.                reds.weeks = reds.weeks + 1
  288.             end
  289.             sep = line
  290.          end
  291.       end
  292.       close(datafile)
  293.    end
  294.    else do
  295.       say
  296.       say ma_t1
  297.       say
  298.       say ma_t3"'"league_file || input2_file"'."
  299.       exit
  300.    end
  301. end                      /* DATES and automatic scheduling */
  302.  
  303. if type = 20 then do
  304.    weeks = 1
  305.    mnth = substr(start_date,3,2)
  306.    ndate= substr(start_date,5,4)||mnth||substr(start_date,1,2)
  307.    range = date('b',ndate,'s')
  308.    range = range + 6
  309.    games.weeks = 0
  310.    weekend.weeks = range
  311.    homew.weeks = 0
  312.    awayw.weeks = 0
  313.    draws.weeks = 0
  314.    losses.weeks = 0
  315.    goalss.weeks = 0
  316.    yellows.weeks= 0
  317.    reds.weeks = 0
  318.    owngoals.weeks = 0
  319.    attendances.weeks = 0
  320.    goals_for = 0
  321.    goals_aga = 0
  322.    goals = 0
  323.    s_l = 0
  324.    match1 = ""
  325.    match2 = ""
  326.  
  327.    if open(datafile2,league_file || input2_file,'r') then do
  328.       do while ~eof(datafile2)
  329.          line = readln(datafile2)
  330.          if pos("**",line) = 0 & length(line) > 1 then do
  331.             secount         = secount + 1
  332.             selines.secount = strip(line)
  333.             semkrs.secount  = 0
  334.          end
  335.       end
  336.       close(datafile2)
  337.    end
  338.    else do
  339.       say
  340.       say ma_t1
  341.       say
  342.       say ma_t3"'"league_file || input2_file"'."
  343.       exit
  344.    end
  345.  
  346.    if open(datafile,league_file || input3_file,'r') then do
  347.       do while ~eof(datafile)
  348.          line = readln(datafile)
  349.          if pos(separator,line) > 0 then do
  350.             if pos("*Date:",line) > 0 then do
  351.                if s_l = 0 then do
  352.                   parse var line "*Date:" dateall
  353.                   search_loc = strip(word(dateall,words(dateall)-1))
  354.                   do mnls=1 to 12
  355.                      if pos(word(months,mnls),search_loc) > 0 then do
  356.                         s_l = 1
  357.                         leave
  358.                      end
  359.                   end
  360.                   if s_l = 0 then do
  361.                      locale_cats = showdir("Locale/")
  362.                      do search_locale=1 to words(locale_cats)
  363.                         dfordir = "Locale/"word(locale_cats,search_locale)"/Football.locale_data"
  364.                         if exists(dfordir) > 0 then do
  365.                           address command rxdir'rx 'dfordir
  366.                           VarCount = getclip('VarCount')
  367.                           do i = 1 to VarCount
  368.                             interpret getclip('var.'i)
  369.                           end
  370.                         end
  371.                         parse var line "*Date:" dateall
  372.                         search_loc = strip(word(dateall,words(dateall)-1))
  373.                         do mnls=1 to 12
  374.                            if pos(word(months,mnls),search_loc) > 0 then do
  375.                               s_l = 1
  376.                               leave
  377.                            end
  378.                         end
  379.                         if s_l = 1 then leave
  380.                      end
  381.                   end
  382.                   if s_l > 0 then do
  383.                      temp_dtal = dateall
  384.                      parse var date_format "day" sp1 "number" sp2 "month" sp3 "year"
  385.                      parse var line "*Date:" dateall
  386.                      do i=1 to 7
  387.                         if pos(word(days,i),dateall) > 0 then do
  388.                            lk = pos(word(days,i),dateall)
  389.                            dateall = delstr(dateall,1,lk+length(word(days,i))+length(sp1)-1)
  390.                         end
  391.                      end
  392.                      dateall = strip(dateall)
  393.                      year = word(dateall,words(dateall))
  394.                      mnth = strip(word(dateall,words(dateall)-1))
  395.                      do lm=1 to length(mnth)
  396.                         if datatype(substr(mnth,1,1),'m') ~= 1 then
  397.                            mnth = delstr(mnth,1,1)
  398.                      end
  399.                      dateall = temp_dtal
  400.                      day  = word(dateall,2)
  401.                      do lm=1 to length(day)-2
  402.                         if datatype(substr(day,3,1),'n') ~= 1 then
  403.                            day = delstr(day,3,1)
  404.                      end
  405.                      cv = 0
  406.                      do i=1 to 12
  407.                         if pos(word(months,i),mnth) > 0 then do
  408.                            cv = i
  409.                            leave
  410.                         end
  411.                      end
  412.                   end
  413.                end
  414.                if s_l = 0 then do
  415.                   say
  416.                   say ma_t1
  417.                   say
  418.                   say ma_t11
  419.                   exit
  420.                end
  421.                sd   = year||right(cv,2,0)||right(day,2,0)
  422.                search_date = date('b',sd,'s')
  423.                s_l = 0
  424.  
  425.                if search_date > range then do
  426.                   range = range + 7
  427.                   diff  = 1
  428.                                                /* this hopes to skip weeks where no games are played. */
  429.                   do while (diff > 0)
  430.                      diff = search_date - range
  431.                      if diff > 0 then
  432.                         range = range + 7
  433.                   end
  434.                   weeks = weeks + 1
  435.                   games.weeks = 0
  436.                   weekend.weeks = range
  437.                   homew.weeks = 0
  438.                   awayw.weeks = 0
  439.                   draws.weeks = 0
  440.                   losses.weeks = 0
  441.                   goalss.weeks = 0
  442.                   goals_for = 0
  443.                   goals_aga = 0
  444.                   goals = 0
  445.                   yellows.weeks= 0
  446.                   reds.weeks = 0
  447.                   attendances.weeks = 0
  448.                   owngoals.weeks = 0
  449.                end
  450.             end
  451.          end
  452.          if pos(separator,line) = 0 & pos(not_played,line) = 0 then do
  453.             goals_for = strip(substr(line,32,2))
  454.             goals_aga = strip(substr(line,37,2))
  455.             if datatype(goals_for,'n') > 0 & datatype(goals_aga,'n') > 0 then do
  456.  
  457.                games.weeks = games.weeks + 1
  458.                goalss.weeks = goalss.weeks + goals_for + goals_aga
  459.  
  460.                if goals_for > goals_aga then do
  461.                   homew.weeks = homew.weeks + 1
  462.                   losses.weeks= losses.weeks + 1
  463.                end
  464.                if goals_for = goals_aga then do
  465.                   draws.weeks = draws.weeks + 1
  466.                end
  467.                if goals_for < goals_aga then do
  468.                   awayw.weeks = awayw.weeks + 1
  469.                   losses.weeks= losses.weeks + 1
  470.                end
  471.                stor1 = 0
  472.                do kej=1 to secount
  473.                   if semkrs.kej = 0 then do
  474.                      if pos(separator,selines.kej) = 0 then do
  475.                         if stor1 = 1 then leave
  476.                         if strip(selines.kej) == strip(line) then stor1 = 1
  477.                         if stor1 = 1 then semkrs.kej = 1
  478.                      end
  479.                      else do
  480.                         if stor1 = 1 then do
  481.                            if pos("(og)",selines.kej) > 0 then do
  482.                               og_mkr = 1
  483.                               owngoals.weeks = owngoals.weeks + 1
  484.                            end
  485.                            if pos("*ATD=",selines.kej) > 0 then do
  486.                               att_mkr = 1
  487.                               parse var selines.kej "*ATD=" attend
  488.                               attendances.weeks = attendances.weeks + attend
  489.                            end
  490.                            if pos("*HY=",selines.kej) > 0 | pos("*AY=",selines.kej) > 0 then do
  491.                               yel_mkr = 1
  492.                               yellows.weeks = yellows.weeks + 1
  493.                            end
  494.                            if pos("*HR=",selines.kej) > 0 | pos("*AR=",selines.kej) > 0 then do
  495.                               red_mkr = 1
  496.                               reds.weeks = reds.weeks + 1
  497.                            end
  498.                            if pos("*HYR=",selines.kej) > 0 | pos("*AYR=",selines.kej) > 0 then do
  499.                               yel_mkr = 1
  500.                               red_mkr = 1
  501.                               yellows.weeks = yellows.weeks + 1
  502.                               reds.weeks = reds.weeks + 1
  503.                            end
  504.                            semkrs.kej = 1
  505.                         end
  506.                      end
  507.                   end
  508.                end
  509.             end
  510.          end
  511.       end
  512.       close(datafile)
  513.    end
  514.    else do
  515.       say
  516.       say ma_t1
  517.       say
  518.       say ma_t3"'"league_file || input3_file"'."
  519.       exit
  520.    end
  521. end
  522.  
  523. lowest = 10000
  524. highest= 0
  525. h = 0
  526. l = 0
  527. g = 0
  528. los = 0
  529. losc= 0
  530. hwn = 0
  531. hwnc= 0
  532. awn = 0
  533. awnc= 0
  534. dra = 0
  535. drac= 0
  536. ogs = 0
  537. ogsc= 0
  538. rcs = 0
  539. rcsc= 0
  540. ycs = 0
  541. ycsc= 0
  542. acs = 0
  543. acsc= 0
  544. do i=1 to weeks
  545.    if games.i ~= 0 then do
  546.       if goalss.i > highest then do
  547.          highest = goalss.i
  548.          h = i
  549.       end
  550.       if goalss.i < lowest then do
  551.          lowest = goalss.i
  552.          l = i
  553.       end
  554.       g = g + games.i
  555.       if losses.i > los then do
  556.          los = losses.i
  557.          losc= i
  558.       end
  559.       if homew.i > hwn then do
  560.          hwn = homew.i
  561.          hwnc= i
  562.       end
  563.       if awayw.i > awn then do
  564.          awn = awayw.i
  565.          awnc= i
  566.       end
  567.       if draws.i > dra then do
  568.          dra = draws.i
  569.          drac= i
  570.       end
  571.       if attendances.i > acs then do
  572.          acs = attendances.i
  573.          acsc= i
  574.       end
  575.       if yellows.i > ycs then do
  576.          ycs = yellows.i
  577.          ycsc= i
  578.       end
  579.       if reds.i > rcs then do
  580.          rcs = reds.i
  581.          rcsc= i
  582.       end
  583.       if owngoals.i > ogs then do
  584.          ogs = owngoals.i
  585.          ogsc= i
  586.       end
  587.    end
  588. end
  589.  
  590. hgpmwk = 0
  591. lgpmwk = 0
  592. hgpm   = 0
  593. lgpm   = 1000
  594. tscr   = 0
  595.  
  596. do i=1 to weeks
  597.    if games.i ~= 0 then do
  598.       tscr = trunc(goalss.i/games.i,2)
  599.       if tscr > hgpm then do
  600.          hgpm = tscr
  601.          if type < 20 then
  602.             hgpmwk = i
  603.          else
  604.             hgpmwk = weekend.i
  605.       end
  606.       if tscr < lgpm then do
  607.          lgpm = tscr
  608.          if type < 20 then
  609.             lgpmwk = i
  610.          else
  611.             lgpmwk = weekend.i
  612.       end
  613.    end
  614. end
  615.  
  616. say
  617. say center(txt_league_title"'"league_title"'",78)
  618. say "----------------------------------------------------------------------------------------------------"
  619. say
  620. say txt_matches""g
  621. say
  622. if type < 20 then do
  623.    say txt_weekwins1""hwnc""txt_high1""hwn""txt_wins
  624.    say txt_weekwins2""awnc""txt_high1""awn""txt_wins
  625.    say txt_weekloss""losc""txt_high1""los""txt_losses
  626.    say txt_weekdraws""drac""txt_high1""dra""txt_draws
  627.    if og_mkr = 1 then say txt_weekog""ogsc""txt_high1""ogs""txt_ogoals
  628.    if red_mkr= 1 then say txt_weekred""rcsc""txt_high1""rcs""txt_reds
  629.    if yel_mkr= 1 then say txt_weekyell""ycsc""txt_high1""ycs""txt_yellows
  630.    if att_mkr= 1 then say txt_weekattd""acsc""txt_high1""acs
  631.    say
  632.    say txt_weekhiscore""h""txt_high1""highest""txt_goals
  633.    say txt_weekloscore""l""txt_high1""lowest""txt_goals
  634.    say
  635.    say ma_t6""hgpmwk""txt_high1""hgpm" "ma_t10
  636.    say ma_t7""lgpmwk""txt_high1""lgpm" "ma_t10
  637.    say
  638. end
  639. else do
  640.    say txt_datewins1"'"getweek(weekend.hwnc)"'"txt_high1""hwn""txt_wins
  641.    say txt_datewins2"'"getweek(weekend.awnc)"'  with "awn" wins."
  642.    say txt_dateloss"'"getweek(weekend.losc)"'"txt_high1""los""txt_losses
  643.    say txt_datedraws"'"getweek(weekend.drac)"'"txt_high1""dra""txt_draws
  644.    if og_mkr = 1 then say txt_dateog"'"getweek(weekend.ogsc)"'"txt_high1""ogs""txt_ogoals
  645.    if red_mkr= 1 then say txt_datered"'"getweek(weekend.rcsc)"'"txt_high1""rcs""txt_reds
  646.    if yel_mkr= 1 then say txt_dateyell"'"getweek(weekend.ycsc)"'"txt_high1""ycs""txt_yellows
  647.    if att_mkr= 1 then say txt_dateattd"'"getweek(weekend.acsc)"'"txt_high1""acs
  648.    say
  649.    say txt_datehiscore"'"getweek(weekend.h)"'"txt_high1""highest""txt_goals
  650.    say txt_dateloscore"'"getweek(weekend.l)"'"txt_high1""lowest""txt_goals
  651.    say
  652.    say ma_t8" '"getweek(hgpmwk)"'"txt_high1""hgpm" "ma_t10
  653.    say ma_t9" '"getweek(lgpmwk)"'"txt_high1""lgpm" "ma_t10
  654. end
  655. say
  656. say
  657. if type < 20 then do
  658.    if og_mkr = 1 then txt_weektable1 = txt_weektable1"    "txt_owngoals1
  659.    if og_mkr = 1 then txt_weektable2 = txt_weektable2"    "txt_owngoals2
  660.    if yel_mkr = 1 then txt_weektable1 = txt_weektable1"    "left(' ',length(txt_bookings),' ')
  661.    if yel_mkr = 1 then txt_weektable2 = txt_weektable2"    "txt_bookings
  662.    if red_mkr = 1 then txt_weektable1 = txt_weektable1"    "txt_sendingoff1
  663.    if red_mkr = 1 then txt_weektable2 = txt_weektable2"    "txt_sendingoff2
  664.    if att_mkr = 1 then txt_weektable1 = txt_weektable1"    "left(' ',length(txt_attends),' ')
  665.    if att_mkr = 1 then txt_weektable2 = txt_weektable2"    "txt_attends
  666.    say txt_weektable1
  667.    say txt_weektable2
  668. end
  669. else do
  670.    if og_mkr = 1 then txt_datetable1 = txt_datetable1"    "txt_owngoals1
  671.    if og_mkr = 1 then txt_datetable2 = txt_datetable2"    "txt_owngoals2
  672.    if yel_mkr = 1 then txt_datetable1 = txt_datetable1"    "left(' ',length(txt_bookings),' ')
  673.    if yel_mkr = 1 then txt_datetable2 = txt_datetable2"    "txt_bookings
  674.    if red_mkr = 1 then txt_datetable1 = txt_datetable1"    "txt_sendingoff1
  675.    if red_mkr = 1 then txt_datetable2 = txt_datetable2"    "txt_sendingoff2
  676.    if att_mkr = 1 then txt_datetable1 = txt_datetable1"    "left(' ',length(txt_attends),' ')
  677.    if att_mkr = 1 then txt_datetable2 = txt_datetable2"    "txt_attends
  678.    say txt_datetable1
  679.    say txt_datetable2
  680. end
  681. if og_mkr = 1 then txt_line = txt_line"    "txt_ogl
  682. if yel_mkr = 1 then txt_line = txt_line"    "txt_bl
  683. if red_mkr = 1 then txt_line = txt_line"    "txt_sol
  684. if att_mkr = 1 then txt_line = txt_line"    "txt_al
  685. say txt_line
  686. say
  687. if type < 20 then do
  688.    do i=1 to weeks
  689.       if games.i ~= 0 then do
  690.          poss_more = ""
  691.          if og_mkr = 1 then poss_more = poss_more"    "left(owngoals.i,length(txt_owngoals1))
  692.          if yel_mkr = 1 then poss_more = poss_more"    "left(yellows.i,length(txt_bookings))
  693.          if red_mkr = 1 then poss_more = poss_more"    "left(reds.i,length(txt_sendingoff1))
  694.          if att_mkr = 1 then poss_more = poss_more"    "left(attendances.i,length(txt_attends))
  695.          say "  "left(i,6)"      "left(games.i,4)"     "left(homew.i,3)"   "left(awayw.i,3)"     "left(draws.i,4)"     "left(losses.i,5)"     "left(goalss.i,5)""poss_more
  696.       end
  697.    end
  698. end
  699. if type = 20 then do
  700.    do i=1 to weeks
  701.       if games.i ~= 0 then do
  702.          poss_more = ""
  703.          if og_mkr = 1 then poss_more = poss_more"    "left(owngoals.i,length(txt_owngoals1))
  704.          if yel_mkr = 1 then poss_more = poss_more"    "left(yellows.i,length(txt_bookings))
  705.          if red_mkr = 1 then poss_more = poss_more"    "left(reds.i,length(txt_sendingoff1))
  706.          if att_mkr = 1 then poss_more = poss_more"    "left(attendances.i,length(txt_attends))
  707.          sd = getweek(weekend.i)
  708.          say left(sd,13)" "left(games.i,4)"     "left(homew.i,3)"   "left(awayw.i,3)"     "left(draws.i,4)"     "left(losses.i,5)"     "left(goalss.i,5)""poss_more
  709.       end
  710.    end
  711. end
  712. say
  713. say "----------------------------------------------------------------------------------------------------"
  714.  
  715. a = 0
  716. do i=1 to secount
  717.    if semkrs.i = 0 then do
  718.       a = a + 1
  719.       if a = 1 then do
  720.          say
  721.          say
  722.          say "There might a program error or datafile problem as the"
  723.          say "following data has not been used :"
  724.          say
  725.       end
  726.       say selines.i
  727.    end
  728. end
  729.  
  730. exit
  731.  
  732. /* Procedure --------------------------------------------------------- */
  733.  
  734. getweek:
  735. parse arg days
  736.  
  737. dd = days - 722450
  738. dd = date('n',dd,'i')
  739. dd = delstr(dd,8,2)
  740. parse var dd dy mn yy
  741.  
  742. dy = strip(dy)
  743. mn = strip(mn)
  744. yy = strip(yy)
  745. parse var date_format "day" sp1 "number" sp2 "month" sp3 "year"
  746. dd = dy||sp2||mn||sp3||yy
  747. return dd
  748.  
  749. /* ------------------------------------------------------------------- */